#! /bin/bash
HOST=http://update.gonsincloud.com
CURRENT_PATH=${PWD}

mkdir ~/.docker_kl_environment
cd ~/.docker_kl_environment

## 下载文件
wget -nc ${HOST}/docker/containerd.io_1.4.6-1_amd64.deb
wget -nc ${HOST}/docker/docker-ce-cli_20.10.7_3-0_ubuntu-xenial_amd64.deb
wget -nc ${HOST}/docker/docker-ce_20.10.7_3-0_ubuntu-xenial_amd64.deb

## 安装docker
sudo dpkg -i containerd.io_1.4.6-1_amd64.deb
sudo dpkg -i docker-ce-cli_20.10.7_3-0_ubuntu-xenial_amd64.deb
sudo dpkg -i docker-ce_20.10.7_3-0_ubuntu-xenial_amd64.deb

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.conf <<-'EOF'
{
  "registry-mirrors": ["https://bbcofja0.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker


## 安装portainer
# sudo docker pull docker.io/portainer/portainer
sudo docker pull registry.cn-shenzhen.aliyuncs.com/gonsinrd/portainer
sudo docker volume create portainer_data
sudo docker run -d -p 9000:9000 --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --name portainer registry.cn-shenzhen.aliyuncs.com/gonsinrd/portainer

sudo apt install docker-compose -y